<template>
  <div :key="componentKey">
    <vol-box :lazy="true" v-model="model" title="物料主表-导入" :height="400" :width="700" :padding="5"
      :onModelClose="onModelClose">
      <!-- <div style="display: flex">
        <div class="block">
          <span class="demonstration">定价流程编号：</span>
          <el-input type="string" v-model="bomnumber" placeholder="请填写定价流程编号(非必填)" style="width: 200px;"></el-input>

        </div>
        <div style="color:red; padding-top:5px;">
          &nbsp;&nbsp;&nbsp;&nbsp;
        </div>
      </div><br> -->
      <UploadExcel :url="url" :template="template" :importExcelBefore="importExcelBefore"
        :addExtraParameter="addExtraParameter"></UploadExcel>
    </vol-box>
  </div>
</template>
<script>
import VolBox from "@/components/basic/VolBox.vue";
import UploadExcel from "@/components/basic/UploadExcelFinanceGeneral.vue";
export default {
  components: {
    'vol-box': VolBox,
    UploadExcel
  },
  data() {
    return {
      url: "api/cw_djlc_wlzb/import", //导入的路径 
      template: { //下载模板的配置
        url: this.http.ipAddress + "api/cw_djlc_wlzb/DownLoadTemplate1",//下载模板的路径 
        fileName: "物料管理", //模板的文件名
      },
      model: false,
    };
  },
  methods: {
    openModel() {
      this.model = true;
    },
    importExcelBefore(formData) { //点击上传时，将其他参数提交到后台
      var code = null;
      var url = null;
      var flage = false;
      if(this.$store.temp == 'import1'){
        code = this.$store.parameter;
        url = "api/cw_djlc_wlzb/import1";
        flage = true;
      }
      formData.append("parameter", code);
      formData.append("url", url);
      formData.append("flage", flage);
      return true;
    },
    addExtraParameter(formData) { //点击上传时，将其他参数提交到后台
      return true;
    },
    onModelClose(){
      this.$emit('parentCall', $parent => { $parent.refresh() });
      //this.$store.getters.data().cw_djlc_wlzb_refresh.refresh();
      this.componentKey++;
    },
  },
};
</script>